import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.env.PropertySourceLoader;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.EnumerablePropertySource;


/**
 * spring-cloud 上下文启动的时候加载
 */

@Configuration
@ConditionalOnClass(name = "com.bytedance.data.tcc.client.TccConfigClient")
@ConditionalOnSpringBoot2
@EnableConfigurationProperties(TccPlusProperties.class)
public class TccPropertySourceLocatorSpringBoot2x extends BaseTccPropertySourceLocator {
    public TccPropertySourceLocatorSpringBoot2x(TccPlusProperties tccPlus) {
        super(tccPlus);
    }

    @Override
    protected EnumerablePropertySource<Object> createTccPropertySource(TccPlusProperties.TccConfig tcc, PropertySourceLoader loader) {
        return new TccPropertySourceSpringBoot2x(tcc, loader).init();
    }
}
